package com.zh.note.huawei.twohundred.最多获得的短信条数;

import java.util.Arrays;

/**
 * @Author: zhanghuan
 * @date: 2023/8/14 17:22
 * @description: create it
 */
public class Main {
    public static void main(String[] args) {
        // Scanner sc = new Scanner(System.in);
        // int n = sc.nextInt();
        // String input = sc.nextLine();
        int n = 6;
        String input = "10 20 30 40 60";
        int[] price = Arrays.stream(input.split(" ")).mapToInt(Integer::parseInt).toArray();
        int[] dp = new int[n + 1];
        for (int i = 1; i <= price.length; i++) {
            for (int j = n; j >= i; j--) {
                dp[j] = Math.max(dp[j], dp[j - i] + price[i - 1]);
            }
        }
        System.out.println(dp[n]);
    }
}
